home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ARexxTools / fpl70.lha / src / liballoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-19  |  4.9 KB  |  139 lines

  1. /******************************************************************************
  2.  *              FREXX PROGRAMMING LANGUAGE                  *
  3.  ******************************************************************************
  4.  
  5.  liballoc.h
  6.  
  7.  Stack allocation routine prototypes.
  8.  
  9.  *****************************************************************************/
  10.  
  11. /************************************************************************
  12.  *                                                                      *
  13.  * fpl.library - A shared library interpreting script langauge.         *
  14.  * Copyright (C) 1992-1994 FrexxWare                                    *
  15.  * Author: Daniel Stenberg                                              *
  16.  *                                                                      *
  17.  * This program is free software; you may redistribute for non          *
  18.  * commercial purposes only. Commercial programs must have a written    *
  19.  * permission from the author to use FPL. FPL is *NOT* public domain!   *
  20.  * Any provided source code is only for reference and for assurance     *
  21.  * that users should be able to compile FPL on any operating system     *
  22.  * he/she wants to use it in!                                           *
  23.  *                                                                      *
  24.  * You may not change, resource, patch files or in any way reverse      *
  25.  * engineer anything in the FPL package.                                *
  26.  *                                                                      *
  27.  * This program is distributed in the hope that it will be useful,      *
  28.  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
  29.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                 *
  30.  *                                                                      *
  31.  * Daniel Stenberg                                                      *
  32.  * Ankdammsgatan 36, 4tr                                                *
  33.  * S-171 43 Solna                                                       *
  34.  * Sweden                                                               *
  35.  *                                                                      *
  36.  * FidoNet 2:201/328    email:dast@sth.frontec.se                       *
  37.  *                                                                      *
  38.  ************************************************************************/
  39.  
  40. #include <exec/libraries.h>
  41.  
  42. struct MyLibrary {
  43.         struct             Library ml_Lib;
  44.         ULONG              ml_SegList;
  45.         ULONG              ml_Flags;
  46.         APTR               ml_ExecBase; /* pointer to exec base  */
  47. #ifndef ORIGINAL
  48.         struct Library *   ml_DosBase;  /* pointer to dos base */
  49. #endif
  50. };
  51.  
  52. /*****************************************************
  53.  *
  54.  * InitStack(...);
  55.  *
  56.  * Initialize a new stack and call Script().
  57.  * Input : a (struct Data *) should be the first input.
  58.  * Returns: nothing, but there's a new stack pointer!
  59.  ******/
  60. long InitStack(...);
  61.  
  62. /*****************************************************
  63.  *
  64.  * EndStack(char **stackbase, int stacksize);
  65.  *
  66.  * Swaps back to original stack.
  67.  * Input : Pointer to the stack base and max stack size.
  68.  * Returns: nothing, but we're back with the original stack pointer.
  69.  ******/
  70. void __asm EndStack(register __a0 struct Data*, register __d0 long);
  71.  
  72. /*****************************************************
  73.  *
  74.  * CheckStack(char **stackbase);
  75.  *
  76.  * Check whether to expand stack.
  77.  * Input : struct Data *, stack limit, stack margin (minimum stack free)
  78.  * Returns: NULL if ok, 1=out of mem, 2=Stack full.
  79.  ******/
  80. long __asm CheckStack(register __a3 struct Data *,
  81.               register __d2 long,
  82.               register __d3 long);
  83.  
  84. /******************************************************
  85.  *
  86.  * GetStackSize(struct Data *);
  87.  *
  88.  * Returns the current stack size in D0.
  89.  *
  90.  *******/
  91.  
  92. long __asm GetStackSize(register __a0 struct Data *);
  93.  
  94. /******************************************************
  95.  *
  96.  * GetStackUsed(struct Data *);
  97.  *
  98.  * Returns the current stack size used in D0.
  99.  *
  100.  *******/
  101.  
  102. long __asm GetStackUsed(register __a0 struct Data *);
  103.  
  104. /******************************************************
  105.  *
  106.  * InterfaceCall();
  107.  *
  108.  * Calls a user function - with the original registers set!
  109.  *
  110.  ******/
  111.  
  112. long __asm InterfaceCall(register __a1 struct Data *,
  113.                  register __a0 void *, /* function argument */
  114.              register __a2 long __asm (*)(register __a0 void *));
  115.  
  116. /******************************************************
  117.  *
  118.  * StoreRegisters();
  119.  *
  120.  * Store all registers as they look now to be read and
  121.  * set each time the interface function is called!
  122.  *
  123.  *******/
  124.  
  125. void __asm StoreRegisters(register __a0 struct Data *);
  126.  
  127. /******************************************************
  128.  *
  129.  * The lock and unlock routines.
  130.  *
  131.  * Specify memory address and bit number of the
  132.  * semaphore to use!
  133.  *
  134.  *******/
  135.  
  136. void __asm Locker(register __a0 long *, register __d0 char);
  137.  
  138. void __asm Unlocker(register __a0 long *, register __d0 char);
  139.